
<!DOCTYPE HTML>
<html lang="zh" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>表达式、声明和语句 · Pine Script 用户手册中文版</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="剑客">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="10function.html" />
    
    
    <link rel="prev" href="8function.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="輸入並搜尋" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../Introduction.html">
            
                <a href="../Introduction.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../quickstart/">
            
                <a href="../quickstart/">
            
                    
                    快速开始
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../quickstart/example.html">
            
                <a href="../quickstart/example.html">
            
                    
                    Pine Script 示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../quickstart/studyVsStrategy.html">
            
                <a href="../quickstart/studyVsStrategy.html">
            
                    
                    “study” 与 “strategy”
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../quickstart/model.html">
            
                <a href="../quickstart/model.html">
            
                    
                    Pine Script 执行模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../quickstart/series.html">
            
                <a href="../quickstart/series.html">
            
                    
                    序列
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../quickstart/understanding.html">
            
                <a href="../quickstart/understanding.html">
            
                    
                    理解 Pine Script
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../quickstart/editor.html">
            
                <a href="../quickstart/editor.html">
            
                    
                    Pine 编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../quickstart/next.html">
            
                <a href="../quickstart/next.html">
            
                    
                    下一步
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="./">
            
                <a href="./">
            
                    
                    语言基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="1structure.html">
            
                <a href="1structure.html">
            
                    
                    脚本结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="2version.html">
            
                <a href="2version.html">
            
                    
                    版本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="3comment.html">
            
                <a href="3comment.html">
            
                    
                    注释
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="4identifier.html">
            
                <a href="4identifier.html">
            
                    
                    标识符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="5line.html">
            
                <a href="5line.html">
            
                    
                    换行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="6type.html">
            
                <a href="6type.html">
            
                    
                    类型系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="7operator.html">
            
                <a href="7operator.html">
            
                    
                    运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="8function.html">
            
                <a href="8function.html">
            
                    
                    函数和注解
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4.9" data-path="9expressions.html">
            
                <a href="9expressions.html">
            
                    
                    表达式、声明和语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="10function.html">
            
                <a href="10function.html">
            
                    
                    函数声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.11" data-path="11model.html">
            
                <a href="11model.html">
            
                    
                    执行模型
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../features/">
            
                <a href="../features/">
            
                    
                    基本功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../features/1alert.html">
            
                <a href="../features/1alert.html">
            
                    
                    警报
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../features/2array.html">
            
                <a href="../features/2array.html">
            
                    
                    数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../features/3barstate.html">
            
                <a href="../features/3barstate.html">
            
                    
                    柱状态，内置变量 barstate.*
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../features/4color.html">
            
                <a href="../features/4color.html">
            
                    
                    颜色
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../features/5context.html">
            
                <a href="../features/5context.html">
            
                    
                    上下文切换和 security 函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../features/6drawing.html">
            
                <a href="../features/6drawing.html">
            
                    
                    绘图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../features/7extend.html">
            
                <a href="../features/7extend.html">
            
                    
                    延长和扩展交易数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../features/8reapint.html">
            
                <a href="../features/8reapint.html">
            
                    
                    指标重绘
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="../features/9nonstandard.html">
            
                <a href="../features/9nonstandard.html">
            
                    
                    非标准图表类型数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="../features/10session.html">
            
                <a href="../features/10session.html">
            
                    
                    交易时段和时间信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.11" data-path="../features/11strategies.html">
            
                <a href="../features/11strategies.html">
            
                    
                    策略
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.12" data-path="../features/12table.html">
            
                <a href="../features/12table.html">
            
                    
                    图表
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../annotations/">
            
                <a href="../annotations/">
            
                    
                    注解概览
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../annotations/1study.html">
            
                <a href="../annotations/1study.html">
            
                    
                    指标注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../annotations/2plot.html">
            
                <a href="../annotations/2plot.html">
            
                    
                    绘图注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../annotations/3input.html">
            
                <a href="../annotations/3input.html">
            
                    
                    脚本输入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../annotations/4price.html">
            
                <a href="../annotations/4price.html">
            
                    
                    价格水平，hline
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../annotations/5fill.html">
            
                <a href="../annotations/5fill.html">
            
                    
                    用 fill 填充背景
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../annotations/6barcolor.html">
            
                <a href="../annotations/6barcolor.html">
            
                    
                    使用 barcolor 为 series 着色
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../annotations/7bg.html">
            
                <a href="../annotations/7bg.html">
            
                    
                    使用 bgcolor 进行背景着色
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../annotations/8shape.html">
            
                <a href="../annotations/8shape.html">
            
                    
                    绘制形状、字符和箭头
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../annotations/9custom.html">
            
                <a href="../annotations/9custom.html">
            
                    
                    定制 OHLC 柱和蜡烛
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../debugging/">
            
                <a href="../debugging/">
            
                    
                    调试
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../debugging/1introduction.html">
            
                <a href="../debugging/1introduction.html">
            
                    
                    指标注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../debugging/2land.html">
            
                <a href="../debugging/2land.html">
            
                    
                    功能位置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../debugging/3num.html">
            
                <a href="../debugging/3num.html">
            
                    
                    显示数值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../debugging/4str.html">
            
                <a href="../debugging/4str.html">
            
                    
                    显示字符串
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../debugging/5conditions.html">
            
                <a href="../debugging/5conditions.html">
            
                    
                    调试条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../debugging/6fn.html">
            
                <a href="../debugging/6fn.html">
            
                    
                    从内部函数调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../debugging/7for.html">
            
                <a href="../debugging/7for.html">
            
                    
                    从“for”循环内部调试
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../debugging/8tips.html">
            
                <a href="../debugging/8tips.html">
            
                    
                    提示
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../publishing/">
            
                <a href="../publishing/">
            
                    
                    发布脚本
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../publishing/1pvp.html">
            
                <a href="../publishing/1pvp.html">
            
                    
                    公共脚本与私有脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../publishing/2mode.html">
            
                <a href="../publishing/2mode.html">
            
                    
                    发布模式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../publishing/3ps.html">
            
                <a href="../publishing/3ps.html">
            
                    
                    如何发布脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../publishing/4us.html">
            
                <a href="../publishing/4us.html">
            
                    
                    如何更新脚本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../library/">
            
                <a href="../library/">
            
                    
                    公共库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../library/1description.html">
            
                <a href="../library/1description.html">
            
                    
                    描述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../library/2copy.html">
            
                <a href="../library/2copy.html">
            
                    
                    将脚本从公共库复制到您的个人库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../library/3editing.html">
            
                <a href="../library/3editing.html">
            
                    
                    编辑来自公共库的脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../library/4searching.html">
            
                <a href="../library/4searching.html">
            
                    
                    搜索脚本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.5" data-path="../library/5video.html">
            
                <a href="../library/5video.html">
            
                    
                    教学视频
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../appendix/">
            
                <a href="../appendix/">
            
                    
                    附录
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../appendix/1migration.html">
            
                <a href="../appendix/1migration.html">
            
                    
                    Pine 第 3 版迁移指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../appendix/2how.html">
            
                <a href="../appendix/2how.html">
            
                    
                    操作指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../appendix/3err.html">
            
                <a href="../appendix/3err.html">
            
                    
                    Pine 的编译和执行错误
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../more/">
            
                <a href="../more/">
            
                    
                    我可以从哪里获得更多信息？
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本書使用 GitBook 釋出
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >表达式、声明和语句</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x8868;&#x8FBE;&#x5F0F;&#x3001;&#x58F0;&#x660E;&#x548C;&#x8BED;&#x53E5;">&#x8868;&#x8FBE;&#x5F0F;&#x3001;&#x58F0;&#x660E;&#x548C;&#x8BED;&#x53E5;</h1>
<hr>
<h2 id="&#x8868;&#x8FBE;&#x5F0F;">&#x8868;&#x8FBE;&#x5F0F;</h2>
<p>&#x8868;&#x8FBE;&#x5F0F;&#x662F;&#x4E00;&#x4E2A;&#x5E8F;&#x5217;&#xFF0C;&#x5176;&#x4E2D;&#x64CD;&#x4F5C;&#x7B26;&#x6216;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x5E94;&#x7528;&#x4E8E;&#x64CD;&#x4F5C;&#x6570;(&#x53D8;&#x91CF;&#x6216;&#x503C;)&#xFF0C;&#x4EE5;&#x5B9A;&#x4E49;&#x811A;&#x672C;&#x6240;&#x9700;&#x7684;&#x8BA1;&#x7B97;&#x548C;&#x64CD;&#x4F5C;&#x3002;Pine &#x4E2D;&#x7684;&#x8868;&#x8FBE;&#x5F0F;&#x51E0;&#x4E4E;&#x603B;&#x662F;&#x4EA7;&#x751F;&#x4E00;&#x4E2A;&#x7ED3;&#x679C;&#xFF08;&#x4F8B;&#x5916;&#x7684;&#x51FD;&#x6570; study&#xFF0C;fill&#xFF0C;strategy.entry &#x7B49;&#xFF0C;&#x4EA7;&#x751F;&#x526F;&#x4F5C;&#x7528;&#xFF0C;&#x5C06;&#x5728;&#x540E;&#x9762;&#x4ECB;&#x7ECD;&#xFF09;&#x3002;</p>
<p>&#x4EE5;&#x4E0B;&#x662F;&#x4E00;&#x4E9B;&#x7B80;&#x5355;&#x8868;&#x8FBE;&#x5F0F;&#x7684;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code>(high + low + close) / 3
sma(high - low, 10) + sma(close, 20)
</code></pre><h2 id="&#x53D8;&#x91CF;&#x58F0;&#x660E;">&#x53D8;&#x91CF;&#x58F0;&#x660E;</h2>
<p>Pine &#x4E2D;&#x901A;&#x8FC7;&#x4EE5;&#x4E0B;&#x65B9;&#x5F0F;&#x4E4B;&#x4E00;&#x53D8;&#x91CF;&#x58F0;&#x660E;&#xFF1A;&#x4F7F;&#x7528;&#x7279;&#x6B8A;&#x7B26;&#x53F7; = &#x6216;&#x53EF;&#x9009;&#x7684; var &#x5173;&#x952E;&#x5B57;&#x58F0;&#x660E;&#xFF1A;</p>
<pre><code>&lt;identifier&gt; = &lt;expression&gt;
&lt;type&gt; &lt;identifier&gt; = &lt;expression&gt;
var &lt;identifier&gt; = &lt;expression&gt;
var &lt;type&gt; &lt;identifier&gt; = &lt;expression&gt;

&lt;&#x6807;&#x8BC6;&#x7B26;&gt; = &lt;&#x8868;&#x8FBE;&#x5F0F;&gt;
&lt;&#x7C7B;&#x578B;&gt; &lt;&#x6807;&#x8BC6;&#x7B26;&gt; = &lt;&#x8868;&#x8FBE;&#x5F0F;&gt;
var &lt;&#x6807;&#x8BC6;&#x7B26;&gt; = &lt;&#x8868;&#x8FBE;&#x5F0F;&gt;
var &lt;&#x7C7B;&#x578B;&gt; &lt;&#x6807;&#x8BC6;&#x7B26;&gt; = &lt;&#x8868;&#x8FBE;&#x5F0F;&gt;
</code></pre><p>\<identifier> &#x662F;&#x5DF2;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x7684;&#x540D;&#x79F0;&#xFF0C;&#x8BF7;&#x53C2;&#x9605;<a href="4identifier.html">&#x6807;&#x8BC6;&#x7B26;</a>&#x3002;</identifier></p>
<p>\<type> &#x53EF;&#x4EE5;&#x662F;&#x9884;&#x5B9A;&#x4E49;&#x7684;&#x5173;&#x952E;&#x5B57;&#x4E4B;&#x4E00;&#xFF1A;float&#xFF0C;int&#xFF0C;bool&#xFF0C;color&#xFF0C;string&#xFF0C;line &#x6216; label&#x3002;&#x7136;&#x800C;&#xFF0C;&#x5728;&#x5927;&#x591A;&#x6570;&#x60C5;&#x51B5;&#x4E0B;&#xFF0C;&#x663E;&#x5F0F;&#x7C7B;&#x578B;&#x58F0;&#x660E;&#x662F;&#x591A;&#x4F59;&#x7684;&#xFF0C;&#x56E0;&#x4E3A;&#x7C7B;&#x578B;&#x662F;&#x5728;&#x7F16;&#x8BD1;&#x65F6;&#x81EA;&#x52A8;&#x4ECE; = &#x53F3;&#x8FB9;&#x7684; \<expression> &#x63A8;&#x65AD;&#x51FA;&#x6765;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x662F;&#x5426;&#x4F7F;&#x7528;&#x901A;&#x5E38;&#x662F;&#x4E00;&#x4E2A;&#x504F;&#x597D;&#x95EE;&#x9898;&#x3002;&#x4F8B;&#x5982;&#xFF1A;</expression></type></p>
<pre><code>baseLine0 = na          // compile time error!
float baseLine1 = na    // OK
baseLine2 = float(na)   // OK
</code></pre><p>&#x5728;&#x793A;&#x4F8B;&#x7684;&#x7B2C;&#x4E00;&#x884C;&#x4E2D;&#xFF0C;&#x7F16;&#x8BD1;&#x5668;&#x65E0;&#x6CD5;&#x786E;&#x5B9A; baseLine0 &#x53D8;&#x91CF;&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x56E0;&#x4E3A; na &#x662F;&#x4E00;&#x4E2A;&#x6CA1;&#x6709;&#x7279;&#x5B9A;&#x7C7B;&#x578B;&#x7684;&#x6CDB;&#x578B;&#x503C;&#x3002;baseLine1 &#x53D8;&#x91CF;&#x7684;&#x58F0;&#x660E;&#x662F;&#x6B63;&#x786E;&#x7684;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x7684; float &#x7C7B;&#x578B;&#x662F;&#x663E;&#x5F0F;&#x58F0;&#x660E;&#x7684;&#x3002;baseLine2 &#x53D8;&#x91CF;&#x7684;&#x58F0;&#x660E;&#x4E5F;&#x662F;&#x6B63;&#x786E;&#x7684;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x7684;&#x7C7B;&#x578B;&#x53EF;&#x4EE5;&#x4ECE;&#x8868;&#x8FBE;&#x5F0F;&#x6D3E;&#x751F;&#x51FA;&#x6765;&#xFF0C;&#x8868;&#x8FBE;&#x5F0F; float (na) &#x662F; na &#x503C;&#x5230; float &#x7C7B;&#x578B;&#x7684;&#x663E;&#x5F0F;&#x8F6C;&#x6362;&#x3002;baseLine1 &#x7684;&#x58F0;&#x660E;&#x548C; baseLine2 &#x662F;&#x7B49;&#x4EF7;&#x7684;&#x3002;</p>
<p>var &#x5173;&#x952E;&#x5B57;&#x662F;&#x4E00;&#x4E2A;&#x7279;&#x6B8A;&#x7684;&#x4FEE;&#x9970;&#x7B26;&#xFF0C;&#x5B83;&#x6307;&#x793A;&#x7F16;&#x8BD1;&#x5668;&#x53EA;&#x521B;&#x5EFA;&#x548C;&#x521D;&#x59CB;&#x5316;&#x53D8;&#x91CF;&#x4E00;&#x6B21;&#x3002;&#x5F53;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x7684;&#x503C;&#x5FC5;&#x987B;&#x5728;&#x811A;&#x672C;&#x7684;&#x8FDE;&#x7EED;&#x8FED;&#x4EE3;&#x4E2D;&#x6301;&#x4E45;&#x5316;&#x65F6;&#xFF0C;&#x8FD9;&#x79CD;&#x884C;&#x4E3A;&#x975E;&#x5E38;&#x6709;&#x7528;&#x3002;&#x4F8B;&#x5982;&#xFF0C;&#x5047;&#x8BBE;&#x6211;&#x4EEC;&#x60F3;&#x8981;&#x8BA1;&#x7B97;&#x56FE;&#x8868;&#x4E2D;&#x7EFF;&#x8272;&#x67F1;&#x7684;&#x6570;&#x91CF;:</p>
<pre><code>//@version=4
study(&quot;Green Bars Count&quot;)
var count = 0
isGreen = close &gt;= open
if isGreen
    count := count + 1
plot(count)
</code></pre><p><img src="../img/GreenBarsCount.png" alt="&#x4EE5;&#x4E0A;&#x4EE3;&#x7801;&#x7684;&#x8FD0;&#x884C;&#x7ED3;&#x679C;"></p>
<p>&#x5982;&#x679C;&#x6CA1;&#x6709; var &#x4FEE;&#x9970;&#x7B26;&#xFF0C;count &#x6BCF;&#x6B21;&#x65B0;&#x7684;&#x67F1;&#x66F4;&#x65B0;&#x89E6;&#x53D1;&#x811A;&#x672C;&#x91CD;&#x65B0;&#x8BA1;&#x7B97;&#x65F6;&#xFF0C;&#x53D8;&#x91CF;&#x90FD;&#x4F1A;&#x91CD;&#x7F6E;&#x4E3A;&#x96F6;&#xFF08;&#x4ECE;&#x800C;&#x5931;&#x53BB;&#x5B83;&#x7684;&#x503C;&#xFF09;&#x3002;</p>
<p>&#x5728; Pine v3 &#x4E2D;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x4E0D;&#x4F7F;&#x7528; var &#x5173;&#x952E;&#x5B57;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x7F16;&#x5199; &#x201C;Green Bars Count&#x201D; &#x6307;&#x6807;&#xFF1A;</p>
<pre><code>//@version=3
study(&quot;Green Bars Count&quot;)
count = 0                       // These two lines could be replaced in v4
count := nz(count[1], count)    // with &apos;var count = 0&apos;
isGreen = close &gt;= open
if isGreen
    count := count + 1
plot(count)
</code></pre><p>v4 &#x4EE3;&#x7801;&#x66F4;&#x5177;&#x53EF;&#x8BFB;&#x6027;&#xFF0C;&#x5E76;&#x4E14;&#x53EF;&#x4EE5;&#x66F4;&#x9AD8;&#x6548;&#xFF0C;&#x4F8B;&#x5982;&#xFF0C;&#x53D8;&#x91CF; count &#x521D;&#x59CB;&#x5316;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x9AD8;&#x9636;&#x51FD;&#x6570;&#x8C03;&#x7528;&#x800C;&#x4E0D;&#x662F; 0&#x3002;</p>
<p>&#x7B80;&#x5355;&#x53D8;&#x91CF;&#x58F0;&#x660E;&#x7684;&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code>src = close
len = 10
ma = sma(src, len) + high
</code></pre><p>&#x5E26;&#x6709;&#x7C7B;&#x578B;&#x4FEE;&#x9970;&#x7B26;&#x548C; var &#x5173;&#x952E;&#x5B57;&#x7684;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code>float f = 10            // NOTE: while the expression is of type int, the variable is float
i = int(close)          // NOTE: explicit cast of float expression close to type int
r = round(close)        // NOTE: round() and int() are different... int() simply throws fractional part away
var hl = high - low
</code></pre><p>&#x793A;&#x4F8B;&#xFF0C;&#x8BF4;&#x660E; var &#x5173;&#x952E;&#x5B57;&#x7684;&#x4F5C;&#x7528;&#xFF1A;</p>
<pre><code>// Creates a new label object on every bar:
// &#x5728;&#x6BCF;&#x4E2A;&#x67F1;&#x4E0A;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; label &#x5BF9;&#x8C61;
label lb = label.new(bar_index, close, text=&quot;Hello, World!&quot;)

// Creates a label object only on the first bar in history:
// &#x53EA;&#x5728;&#x7B2C;&#x4E00;&#x6839;&#x67F1;&#x4E0A;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; label &#x5BF9;&#x8C61;
var label lb = label.new(bar_index, close, text=&quot;Hello, World!&quot;)
</code></pre><h2 id="&#x53D8;&#x91CF;&#x8D4B;&#x503C;">&#x53D8;&#x91CF;&#x8D4B;&#x503C;</h2>
<p>&#x53EF;&#x53D8;&#x53D8;&#x91CF;&#x662F;&#x53EF;&#x4EE5;&#x8D4B;&#x4E88;&#x200B;&#x200B;&#x65B0;&#x503C;&#x7684;&#x53D8;&#x91CF;&#x3002;&#x5FC5;&#x987B;&#x4F7F;&#x7528; := &#x8FD0;&#x7B97;&#x7B26;&#x4E3A;&#x53D8;&#x91CF;&#x8D4B;&#x503C;&#x3002;&#x5FC5;&#x987B;&#x5148;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#xFF0C;&#x7136;&#x540E;&#x624D;&#x80FD;&#x4E3A;&#x5176;&#x8D4B;&#x503C;&#xFF08;&#x8BF7;&#x53C2;&#x9605;&#x4E0A;&#x9762;&#x7684;&#x53D8;&#x91CF;&#x58F0;&#x660E;&#xFF09;&#x3002;</p>
<p>&#x53D8;&#x91CF;&#x7684;&#x7C7B;&#x578B;&#x5728;&#x58F0;&#x660E;&#x65F6;&#x786E;&#x5B9A;&#x3002;&#x53EA;&#x6709;&#x5F53;&#x8868;&#x8FBE;&#x5F0F;&#x548C;&#x53D8;&#x91CF;&#x5C5E;&#x4E8E;&#x540C;&#x4E00;&#x7C7B;&#x578B;&#x65F6;&#xFF0C;&#x624D;&#x80FD;&#x7ED9;&#x53D8;&#x91CF;&#x8D4B;&#x503C;&#x8868;&#x8FBE;&#x5F0F;&#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x51FA;&#x73B0;&#x7F16;&#x8BD1;&#x9519;&#x8BEF;&#x3002;</p>
<p>&#x53D8;&#x91CF;&#x8D4B;&#x503C;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code>//@version=4
study(&quot;My Script&quot;)
price = close
if hl2 &gt; price
    price := hl2
plot(price)
</code></pre><h2 id="if-&#x8BED;&#x53E5;">if &#x8BED;&#x53E5;</h2>
<p>if &#x8BED;&#x53E5;&#x5B9A;&#x4E49;&#x4E86;&#xFF0C;&#x5F53; if &#x6761;&#x4EF6;&#x8868;&#x8FBE;&#x5F0F;&#x8BA1;&#x7B97;&#x4E3A; true &#x65F6;&#x6267;&#x884C;&#x7684;&#x8BED;&#x53E5;&#x5757;&#xFF0C;&#x4EE5;&#x53CA;&#x5F53;&#x8868;&#x8FBE;&#x5F0F;&#x8BA1;&#x7B97;&#x4E3A; false &#x65F6;&#x6267;&#x884C;&#x7684;&#x8BED;&#x53E5;&#x5757;&#x3002;</p>
<p>&#x901A;&#x7528;&#x4EE3;&#x7801;&#x683C;&#x5F0F;&#xFF1A;</p>
<pre><code>&lt;var_declarationX&gt; = if &lt;condition&gt;
    &lt;var_decl_then0&gt;
    &lt;var_decl_then1&gt;
    ...
    &lt;var_decl_thenN&gt;
else if [optional block]
    &lt;var_decl_else0&gt;
    &lt;var_decl_else1&gt;
    ...
    &lt;var_decl_elseN&gt;
else
    &lt;var_decl_else0&gt;
    &lt;var_decl_else1&gt;
    ...
    &lt;var_decl_elseN&gt;
    &lt;return_expression_else&gt;
</code></pre><p>&#x5728;&#x4EE5;&#x4E0A;&#x4F8B;&#x5B50;&#xFF1A;</p>
<ul>
<li>var_declarationX &#x2014;&#x2014; &#x5C06; if &#x8BED;&#x53E5;&#x7684;&#x503C;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x6574;&#x4F53;&#x8D4B;&#x7ED9;&#x8BE5;&#x53D8;&#x91CF;&#x3002;</li>
<li>condition &#x2014;&#x2014; &#x5982;&#x679C; condition &#x8868;&#x8FBE;&#x5F0F;&#x4E3A;&#x771F;&#xFF0C;&#x5219;&#x6267;&#x884C; if &#x7B2C;&#x4E00;&#x884C;&#x540E;&#x9762;&#x7D27;&#x63A5;&#x7740;&#x7684; then &#x5757;&#x903B;&#x8F91; (var_decl_then0, var_decl_then1 &#x7B49;)&#xFF0C;&#x5982;&#x679C;&#x6761;&#x4EF6;&#x4E3A;&#x5047;&#xFF0C;&#x5219;&#x6267;&#x884C; else &#x5757;&#x903B;&#x8F91;(var_decl_else0, var_decl_else1 &#x7B49;)&#x3002;</li>
<li>return_expression_then, return_expression_else &#x2014;&#x2014; then &#x5757;&#x6216; else &#x5757;&#x4E2D;&#x7684;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x8868;&#x8FBE;&#x5F0F;&#x5C06;&#x786E;&#x5B9A;&#x6574;&#x4E2A; if &#x8BED;&#x53E5;&#x7684;&#x6700;&#x7EC8;&#x503C;&#x3002;</li>
</ul>
<p>if &#x8BED;&#x53E5;&#x8FD4;&#x56DE;&#x503C;&#x7684;&#x7C7B;&#x578B;&#x7531; return_expression_then &#x548C; return_expression_else &#x7684;&#x7C7B;&#x578B;&#x51B3;&#x5B9A;&#xFF0C;&#x5B83;&#x4EEC;&#x7684;&#x7C7B;&#x578B;&#x5FC5;&#x987B;&#x5339;&#x914D;&#x3002;&#x5982;&#x679C; else &#x5757;&#x8FD4;&#x56DE;&#x5B57;&#x7B26;&#x4E32;&#x503C;&#xFF0C;&#x5219;&#x4E0D;&#x53EF;&#x80FD;&#x4ECE; then &#x5757;&#x8FD4;&#x56DE;&#x6574;&#x6570;&#x503C;&#x3002;</p>
<p>&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code>// This code compiles
x = if close &gt; open
    close
else
    open
// This code doesn&apos;t compile
x = if close &gt; open
    close
else
    &quot;open&quot;
</code></pre><hr>
<p>else &#x5757;&#x53EF;&#x4EE5;&#x88AB;&#x7701;&#x7565;&#xFF0C;&#x5728;&#x7701;&#x7565; else &#x5757;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x3002;&#x5982;&#x679C; condition &#x662F;&#x5047;&#x503C;&#xFF0C;&#x4E00;&#x4E2A;&#x7A7A;&#x503C;&#xFF08;na&#xFF0C;false&#xFF0C;&#x6216; &quot;&quot;&#xFF09;&#x5C06;&#x88AB;&#x5206;&#x914D;&#x7ED9; var_declarationX &#x53D8;&#x91CF;&#x3002;</p>
<p>&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code>x = if close &gt; open
    close
// If current close &gt; current open, then x = close.
// Otherwise the x = na.
</code></pre><hr>
<p>&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x591A;&#x4E2A; else if &#x5757;&#x6216;&#x6839;&#x672C;&#x4E0D;&#x4F7F;&#x7528;&#x3002;</p>
<p>&#x4F8B;&#x5B50;&#xFF1A;</p>
<pre><code>x = if open &gt; close
    5
else if high &gt; low
    close
else
    open
</code></pre><hr>
<p>then, else if &#x548C; else &#x5757;&#x7F29;&#x8FDB; 4 &#x4E2A;&#x7A7A;&#x683C;&#x3002;If &#x8BED;&#x53E5;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x7F29;&#x8FDB;&#x56DB;&#x4E2A;&#x7A7A;&#x683C;&#x6765;&#x5D4C;&#x5957;:</p>
<pre><code>x = if close &gt; open
    b = if close &gt; close[1]
        close
    else
        close[1]
    b
else
    open
</code></pre><hr>
<p>&#x53EF;&#x4EE5;&#x5FFD;&#x7565; if &#x8BED;&#x53E5;&#x7684;&#x7ED3;&#x679C;&#x503C;(&#x53EF;&#x4EE5;&#x7701;&#x7565; var_declarationX =)&#xFF0C;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x975E;&#x5E38;&#x5E38;&#x89C1;&#x3002;&#x5F53;&#x4F60;&#x53EA;&#x9700;&#x8981;&#x8868;&#x8FBE;&#x5F0F;&#x7684;&#x526F;&#x4F5C;&#x7528;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x8FD9;&#x79CD;&#x5F62;&#x5F0F;&#xFF0C;&#x4F8B;&#x5982;&#x5728;&#x7B56;&#x7565;&#x56DE;&#x6D4B;&#x4E2D;:</p>
<pre><code>if (crossover(source, lower))
    strategy.entry(&quot;BBandLE&quot;, strategy.long, stop=lower,
                   oca_name=&quot;BollingerBands&quot;,
                   oca_type=strategy.oca.cancel, comment=&quot;BBandLE&quot;)
else
    strategy.cancel(id=&quot;BBandLE&quot;)
</code></pre><h2 id="for-&#x8BED;&#x53E5;">for &#x8BED;&#x53E5;</h2>
<p>for &#x8BED;&#x53E5;&#x5141;&#x8BB8;&#x91CD;&#x590D;&#x6267;&#x884C;&#x591A;&#x4E2A;&#x6307;&#x4EE4;:</p>
<pre><code>&lt;var_declarationX&gt; = for &lt;i&gt; = &lt;from&gt; to &lt;to&gt; by &lt;step&gt;
    &lt;var_decl0&gt;
    &lt;var_decl1&gt;
    ...
    continue
    ...
    break
    ...
    &lt;var_declN&gt;
    &lt;return_expression&gt;
</code></pre><p>&#x5728;&#x4EE5;&#x4E0A;&#x4F8B;&#x5B50;&#xFF1A;</p>
<ul>
<li>i &#x2014;&#x2014; &#x4E00;&#x4E2A;&#x5FAA;&#x73AF;&#x8BA1;&#x6570;&#x5668;&#x53D8;&#x91CF;&#x3002;</li>
<li>from &#x2014;&#x2014; &#x8BA1;&#x6570;&#x5668;&#x7684;&#x8D77;&#x59CB;&#x503C;&#x3002;</li>
<li>to &#x2014;&#x2014; &#x8BA1;&#x6570;&#x5668;&#x7684;&#x7ED3;&#x675F;&#x503C;&#x3002;&#x5F53;&#x8BA1;&#x6570;&#x5668;&#x53D8;&#x5F97;&#x5927;&#x4E8E; to (from &gt; to &#x7684;&#x524D;&#x63D0;&#x4E0B;&#x5C0F;&#x4E8E; to)&#x65F6;&#xFF0C;&#x5FAA;&#x73AF;&#x505C;&#x6B62;&#x3002;</li>
<li>step &#x2014;&#x2014; &#x5FAA;&#x73AF;&#x6B65;&#x9AA4;&#x3002;&#x53EF;&#x9009;&#x7684;&#x3002;&#x9ED8;&#x8BA4;&#x4E3A; 1&#x3002;&#x5982;&#x679C; from &#x5927;&#x4E8E; to&#xFF0C;&#x5FAA;&#x73AF;&#x5C06;&#x81EA;&#x52A8;&#x6539;&#x53D8;&#x65B9;&#x5411;&#x3002;&#x65E0;&#x9700;&#x4F7F;&#x7528;&#x8D1F;&#x7684; step&#x3002;</li>
<li>var_decl0, ... var_declN, return_expression &#x2014;&#x2014; &#x5FAA;&#x73AF;&#x4F53;&#x3002;&#x5B83;&#x5FC5;&#x987B;&#x7F29;&#x8FDB; 4 &#x4E2A;&#x7A7A;&#x683C;&#x3002;</li>
<li>return_expression &#x2014;&#x2014; &#x8FD4;&#x56DE;&#x503C;&#x3002;&#x5F53;&#x5FAA;&#x73AF;&#x7ED3;&#x675F;&#x6216;&#x4E2D;&#x65AD;&#x65F6;&#xFF0C;&#x8FD4;&#x56DE;&#x503C;&#x88AB;&#x5206;&#x914D;&#x7ED9; var_declarationX&#x3002;</li>
<li>continue &#x2014;&#x2014; &#x4E2A;&#x5173;&#x952E;&#x8BCD;&#x3002;&#x53EA;&#x80FD;&#x5728;&#x5FAA;&#x73AF;&#x4E2D;&#x4F7F;&#x7528;&#x3002;&#x5B83;&#x8DF3;&#x8F6C;&#x5230;&#x5FAA;&#x73AF;&#x7684;&#x4E0B;&#x4E00;&#x6B21;&#x8FED;&#x4EE3;&#x3002;</li>
<li>break &#x2014;&#x2014; &#x4E2A;&#x5173;&#x952E;&#x8BCD;&#x3002;&#x53EA;&#x80FD;&#x5728;&#x5FAA;&#x73AF;&#x4E2D;&#x4F7F;&#x7528;&#x3002;&#x5B83;&#x9000;&#x51FA;&#x5FAA;&#x73AF;&#x3002;</li>
</ul>
<p>for &#x5FAA;&#x73AF;&#x793A;&#x4F8B;&#xFF1A;</p>
<pre><code>//@version=4
study(&quot;For loop&quot;)
my_sma(price, length) =&gt;
    sum = price
    for i = 1 to length-1
        sum := sum + price[i]
    sum / length
plot(my_sma(close,14))
</code></pre><p>&#x53D8;&#x91CF; sum &#x662F;&#x4E00;&#x4E2A;&#x53EF;&#x53D8;&#x53D8;&#x91CF;&#xFF0C;&#x56E0;&#x6B64;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5FAA;&#x73AF;&#x4F53;&#x4E2D;&#x7684; := &#x64CD;&#x4F5C;&#x7B26;&#x7ED9;&#x5B83;&#x8D4B;&#x4E00;&#x4E2A;&#x65B0;&#x503C;&#x3002;&#x8BF7;&#x6CE8;&#x610F;&#xFF0C;&#x5BF9;&#x4E8E;&#x7B80;&#x5355;&#x7684;&#x79FB;&#x52A8;&#x5E73;&#x5747;&#x7EBF;&#xFF0C;&#x6211;&#x4EEC;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528;&#x5185;&#x7F6E;&#x7684; sma &#x51FD;&#x6570;&#xFF0C;&#x56E0;&#x4E3A;&#x5B83;&#x7684;&#x8BA1;&#x7B97;&#x901F;&#x5EA6;&#x66F4;&#x5FEB;&#x3002;</p>
<p>&#x8BF7;&#x6CE8;&#x610F;&#xFF0C;&#x6709;&#x4E9B;&#x5185;&#x7F6E;&#x51FD;&#x6570;&#x53EF;&#x80FD;&#x5728; for &#x5FAA;&#x73AF;&#x4E2D;&#x8868;&#x73B0;&#x51FA;&#x610F;&#x5916;&#x3002;&#x8BA9;&#x6211;&#x4EEC;&#x770B;&#x770B;&#x4E0B;&#x9762;&#x7684;&#x4F8B;&#x5B50;:</p>
<pre><code>//@version=4
study(&quot;RMA in for loop&quot;)
sum = 0.0
for i = 1 to 2
    sum := sum + rma(close, i)
plot(sum)
</code></pre><p>&#x867D;&#x7136;&#x4F60;&#x53EF;&#x80FD;&#x671F;&#x671B; sum &#x5305;&#x542B; rma(close, 1) + rma(close, 2)&#xFF0C;&#x4F46;&#x4E8B;&#x5B9E;&#x5E76;&#x975E;&#x5982;&#x6B64;&#x3002;&#x5B83;&#x5C06;&#x5305;&#x542B; rma(close, 1) + rma(close, 1)&#xFF0C;&#x56E0;&#x4E3A;&#x4E00;&#x65E6; rma &#x4EE5;&#x957F;&#x5EA6; 1 &#x521D;&#x59CB;&#x5316;&#xFF0C;&#x8FD9;&#x4E2A;&#x957F;&#x5EA6;&#x5C06;&#x88AB;&#x5B58;&#x50A8;&#xFF0C;&#x76F4;&#x5230;&#x811A;&#x672C;&#x4ECE;&#x56FE;&#x8868;&#x4E2D;&#x5220;&#x9664;&#x3002;&#x4E3A;&#x4E86;&#x907F;&#x514D;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#xFF0C;&#x60A8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x81EA;&#x5DF1;&#x7684;&#x65E0;&#x72B6;&#x6001;&#x51FD;&#x6570;&#x5B9E;&#x73B0;&#x3002;&#x4EE5;&#x4E0B;&#x662F;&#x5177;&#x6709;&#x76F8;&#x540C;&#x884C;&#x4E3A;&#x7684;&#x5185;&#x7F6E;&#x51FD;&#x6570;&#x5217;&#x8868;:</p>
<ul>
<li>rma(source, length): length &#x662F;&#x6709;&#x72B6;&#x6001;&#x7684;&#x3002;</li>
<li>ema(source, length): length &#x662F;&#x6709;&#x72B6;&#x6001;&#x7684;&#x3002;</li>
<li>valuewhen(condition, source, occurrence): occurrence &#x662F;&#x6709;&#x72B6;&#x6001;&#x7684;&#x3002;</li>
<li>rsi(x, y): &#x7684; y &#x662F;&#x6574;&#x6570;&#x7C7B;&#x578B;&#x5E76;&#x4E14;&#x4EE3;&#x8868;&#x4E00;&#x4E2A;&#x957F;&#x5EA6;&#xFF0C;y &#x662F;&#x6709;&#x72B6;&#x6001;&#x7684;&#x3002;</li>
</ul>
<p>&#x6CE8;&#xFF1A;<br>TradingView &#x7684; Pine &#x7F16;&#x8F91;&#x5668;&#x81EA;&#x52A8;&#x5C06; Tab &#x66FF;&#x6362;&#x4E3A; 4 &#x4E2A;&#x7A7A;&#x683C;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="8function.html" class="navigation navigation-prev " aria-label="Previous page: 函数和注解">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="10function.html" class="navigation navigation-next " aria-label="Next page: 函数声明">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"表达式、声明和语句","level":"1.4.9","depth":2,"next":{"title":"函数声明","level":"1.4.10","depth":2,"path":"fundamentals/10function.md","ref":"./fundamentals/10function.md","articles":[]},"previous":{"title":"函数和注解","level":"1.4.8","depth":2,"path":"fundamentals/8function.md","ref":"./fundamentals/8function.md","articles":[]},"dir":"ltr"},"config":{"plugins":["livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"剑客","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Pine Script 用户手册中文版","language":"zh","gitbook":"*","description":"Pine Script 文档中文翻译"},"file":{"path":"fundamentals/9expressions.md","mtime":"2021-06-02T13:51:21.024Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-06-14T07:42:18.199Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

